package com.xbs.controller.hitchhiking;

import java.io.IOException;

import javax.servlet.ServletException;
import javax.servlet.annotation.WebServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import com.xbs.controller.base.BaseServlet;
import com.xbs.entity.CommonOrderEntity;
import com.xbs.entity.EmployeeEntity;
import com.xbs.entity.HitchMoneyAdminEntity;
import com.xbs.service.hitchhiking.EmpAdminService;
import com.xbs.service.hitchhiking.HitchOrderAdminService;

/**
 * 租赁之后修改顺风车订单
 * @author dell
 */
@WebServlet("/backstage/xghoa2")
public class XgHitchOrderAdminServlet2 extends BaseServlet{
	@Override
	protected void doPost(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {
		/**
		 * 根据订单编号,还车修改信息
		 */
		HitchOrderAdminService hoas = new HitchOrderAdminService();
		HitchMoneyAdminEntity hmae = new HitchMoneyAdminEntity();
		hmae.setCo_id(req.getParameter("ddbh2"));
		hmae.setCo_order_status(req.getParameter("ddzt2"));
		String com1 =req.getParameter("copater2");
		String com2 =req.getParameter("cph2");
		String com3 =req.getParameter("cxmc2");
		Double m1 = (com1==null||com1.equals(""))?0:Double.valueOf(com1);
		Double m2 = (com2==null||com2.equals(""))?0:Double.valueOf(com2);
		Double m3 = (com3==null||com3.equals(""))?0:Double.valueOf(com3);
		hmae.setCo_compensation(m1);
		hmae.setCo_remark(req.getParameter("bz2"));
		hmae.setOrder_service_money(m2);
		hmae.setOrder_car_damage_money(m3);
		int row = hoas.updateOrderByReturn(hmae);
		System.out.println(row);
		redirect("/backstage/hitchhikingOrder");
		
	}
	@Override
	protected void doGet(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {
		doPost(req, resp);
	}
}
